﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace Vixen
{
    /// <summary>This class acts as an extension of the game. Once initialized, can use the Vixen framework.</summary>
    public static class Engine
    {
        public static GraphicsDevice GraphicsDevice; // The GraphicsDevice passed from the main project.
        public static ContentManager Content; // The ContentManager passed from the main project.

        /// <summary>Initializes needed variables.</summary>
        /// <param name="gD">The main project's GraphicsDevice.</param>
        /// <param name="c">The main project's ContentManager</param>
        public static void Initialize(GraphicsDevice gD, ContentManager c)
        {
            GraphicsDevice = gD;
            Content = c;
        }

        /// <summary>Loads an asset of a specific type.</summary>
        /// <typeparam name="T">The type of asset being loaded.</typeparam>
        /// <param name="assetName">The name of the asset to load.</param>
        public static T LoadAsset<T>(string assetName)
        {
            return Content.Load<T>(assetName);
        }

        #region Nested type: Screen
        /// <summary>Size information regarding the monitor screen.</summary>
        public struct Screen
        {
            public static int X
            {
                get { return GraphicsDevice.Viewport.X; }
            }

            public static int Y
            {
                get { return GraphicsDevice.Viewport.Y; }
            }

            public static int Width
            {
                get { return GraphicsDevice.Viewport.Width; }
            }

            public static int Height
            {
                get { return GraphicsDevice.Viewport.Height; }
            }

            public static Rectangle Area
            {
                get { return new Rectangle(X, Y, Width, Height); }
            }
        }
        #endregion
    }
}